home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00054_Script_vaiPagina < prev    next >
Text File  |  1999-03-19  |  4KB  |  139 lines

  1. on vaiPagina arqNum, saida
  2.   if arqNum = 8 then set arqNum = 7
  3.   
  4.   -- <saida> indica para preparar saida padrao da pagina
  5.   if saida then
  6.     sendSprite(120,#comecaAnima)
  7.     updateStage
  8.     calculaPronde arqNum
  9.     sendAllSprites(#cleanSprite)
  10.   end if
  11.   
  12.   -- Calcula em que parte do CD esta o filme e guarda em
  13.   -- <gDonde>
  14.   calculaDonde
  15.   -- Analogo
  16.   calculaPronde arqNum
  17.   
  18.   if arqNum >= 10000 then
  19.     return vaiVerbete(arqNum, 1)
  20.   else if arqNum >= 1000 and arqNum < 1100 then
  21.     return vaiCriadores(arqNum)
  22.   else if arqNum >= 2000 and arqNum < 2010 then
  23.     return vaiMelhores(arqNum)
  24.   else if arqNum >= 1 and arqNum < 10 then
  25.     return vaiUniversos(arqNum)
  26.   else if arqNum = 0 then
  27.     
  28.   end if
  29.   
  30.   return false
  31. end
  32.  
  33. -- Empilha local por onde se esta passando
  34. on empilhaArq arqNum
  35.   -- Atualiza tabela de StepBack's
  36.   global gStepBack, gStepBackMax, gStepBackIni, gStepBackUlt
  37.   set anterior = gStepBackUlt - 1
  38.   if anterior = 0 then set anterior = gStepBackMax
  39.   set anterior = getAt(gStepBack,anterior)
  40.   if gStepBackUlt = gStepBackIni or anterior <> arqNum then
  41.     setAt(gStepBack, gStepBackUlt, arqNum)
  42.     set gStepBackUlt = gStepBackUlt + 1
  43.     if gStepBackUlt = gStepBackMax + 1 then set gStepBackUlt = 1
  44.     if gStepBackUlt = gStepBackIni then
  45.       -- Estourou buffer, incrementa ini
  46.       set gStepBackIni = gStepBackIni + 1
  47.       if gStepBackIni = gStepBackMax + 1 then set gStepBackIni = 1
  48.     end if
  49.   end if    
  50. end
  51. -- Descobre pagina atual pela pilha
  52. on paginaAtual
  53.   global gStepBack, gStepBackMax, gStepBackIni, gStepBackUlt
  54.   set anterior = gStepBackUlt - 1
  55.   if anterior = 0 then set anterior = gStepBackMax
  56.   set anterior = getAt(gStepBack,anterior)
  57.   return anterior
  58. end
  59.  
  60. -- Retorna arqNum desempilhado, ou -1 se vazio
  61. on desempilhaArq
  62.   global gStepBack, gStepBackMax, gStepBackIni, gStepBackUlt
  63.   if gStepBackIni = gStepBackUlt then return -1
  64.   
  65.   set gStepBackUlt = gStepBackUlt - 1
  66.   if gStepBackUlt = 0 then set gStepBackUlt = gStepBackMax
  67.   return getAt(gStepBack, gStepBackUlt)
  68. end
  69.  
  70. -- Descobre se tela atual nao e' uma "pagina"
  71. on testaPagina 
  72.   set f = the frame
  73.   return not (¼
  74.       (f = marker("Universo")) or ¼
  75.       (f >= marker("Criadores") and f < marker("FimCriadores") and ¼
  76.          the visibility of sprite 12 = false) or¼
  77.       (f = marker("Melhores Momentos")) or¼
  78.       (f >= marker("JapasFotos") and f <= marker("Fim") ) or¼
  79.       (f = marker("nois")) ¼
  80.   )
  81. end
  82.  
  83. -- Faz volta
  84. on fazBack
  85.   if testaPagina() then
  86.     set tmp = desempilhaArq()
  87.   else
  88.     set tmp = -1
  89.   end if
  90.   set arqNum = desempilhaArq()
  91.   if arqNum = -1 then 
  92.     if tmp <> -1 then empilhaArq tmp
  93.     return -1
  94.   else
  95.     vaiPagina arqNum, true
  96.     return arqNum
  97.   end if
  98. end
  99.  
  100. -- Descobre em que parte do CD estamos: Importante
  101. -- pois alguns sprites nao devem ser desligados
  102. -- se viemos da mesma parte
  103. on calculaDonde
  104.   -- De onde vem o frame atual
  105.   global gDonde -- abertura(0), universos(1), momentos(1000), criadores(2000), verbetes(10000)
  106.   set x = the frame  
  107.   if x >= marker("Menu") then
  108.     set gDonde = 0
  109.   else if x >= marker("Melhores Momentos") then 
  110.     set gDonde = 2000
  111.   else if x >= marker("Verbetes") then
  112.     set gDonde = 10000
  113.   else if x >= marker("Criadores") then
  114.     set gDonde = 1000
  115.   else if x >= marker("Universos") then
  116.     set gDonde = 1
  117.   else
  118.     set gDonde = -1
  119.   end if  
  120. end
  121.  
  122. on calculaPronde arqNum
  123.   global gPronde
  124.   
  125.   if arqNum >= 10000 then
  126.     set gPronde = 10000
  127.   else if arqNum >= 1000 and arqNum < 1100 then
  128.     set gPronde = 1000
  129.   else if arqNum >= 2000 and arqNum < 2010 then
  130.     set gPronde = 2000
  131.   else if arqNum >= 1 and arqNum < 10 then
  132.     set gPronde = 1
  133.   else if arqNum = 0 then
  134.     set gPronde = 0
  135.   end if
  136.   
  137.   return false
  138. end
  139.